<template>
  <div></div>
  <!-- <mt-tabbar v-model="selected" fixed class="bgcolor1">
      <mt-tab-item id="tab1">
        <img slot="icon" :src="img[0]" />
        恋爱话术惯例
      </mt-tab-item>
      <mt-tab-item id="tab2">
        <img slot="icon" :src="img[1]" />
        话术聊天实战
      </mt-tab-item>
      <mt-tab-item id="tab3"  v-if="status">
        <img slot="icon" :src="img[2]" />
        个人中心
      </mt-tab-item>
  </mt-tabbar>-->
</template>

<script>
import { znk } from '@/util/public'
export default {
  name: 'footTab',
  props: ['selectedVal'],
  data () {
    return {
      img: [require('@/assets/img/icon1.png'), require('@/assets/img/icon2.png'), require('@/assets/img/icon3.png')],
      selected: '',
      url: '',
      status: true
    }
  },
  mounted () {
    this.url = this.$route.path
    this.selected = this.selectedVal || this.$route.meta.tab
  },
  watch: {
    url: {
      handler (val) {
        if ((this.url).indexOf('/login') >= 0) {
          this.status = false
        }
        console.log('ths', this.$route.path)
      }
    },
    selected: {
      handler (val) {
        console.log('htis', this)
        if (val === 'tab1') {
          this.img[0] = require('@/assets/img/icon1_act.png')
          this.img[1] = require('@/assets/img/icon2.png')
          this.img[2] = require('@/assets/img/icon3.png')
          this.$router.push({ path: '/aiyu/index' })
        } else if (val === 'tab2') {
          this.img[0] = require('@/assets/img/icon1.png')
          this.img[1] = require('@/assets/img/icon2_act.png')
          this.img[2] = require('@/assets/img/icon3.png')
          this.$router.push({ path: '/aiyu/actual' })
        } else if (val === 'tab3') {
          if (!znk.getCookie('token')) {
            console.log('pppp')
            this.$router.push({
              path: '/aiyu/login'
            })
          } else {
            this.img[0] = require('@/assets/img/icon1.png')
            this.img[1] = require('@/assets/img/icon2.png')
            this.img[2] = require('@/assets/img/icon3_act.png')
            this.$router.push({ path: '/aiyu/account' })
          }
        }
      }
    }

  }
}
</script>
